/**
The Chicken McNugget Theorem (or Postage Stamp Problem or Frobenius Coin Problem) states that for any two relatively prime positive integers $m,n$, the greatest integer that cannot be written in the form $am + bn$ for nonnegative integers $a, b$ is $mn-m-n$. 

From: https://artofproblemsolving.com/wiki/index.php/Chicken_McNugget_Theorem

As for this problem, because $\gcd (11, 111) = 1$, all integers greater than $111 \times 11 - 111 - 11 = 1099 should be answered "YES", and we can use brute force to check others.

*/
#include <bits/stdc++.h>
using namespace std;
bool solve(int n) {
    return n >= 111*(n%11);
}
int main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc; cin>>tc;
    while(tc--) {
        int n; cin>>n;
        cout<<(solve(n)?"YES\n":"NO\n");
    }
}
